<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="iconfont/iconfont.css">
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <!--[if lt IE 9]>
            <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js">
            </script>
            <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js">
            </script>
        <![endif]-->
        <script type="text/javascript" src="script/jquery.js"></script>
        <script type="text/javascript" src="js/mui.js"></script>
        <script type="text/javascript" src="script/bootstrap.min.js"></script>
        <script type="text/javascript" src="script/Validform_v5.3.2_min.js"></script>
        <script src="script/uploadimage.js"></script>
        <script type="text/javascript" src="script/jquery.js"></script> 
	</head>
    <style>
    	.nicknames{
    		margin-top:30px;
    	}
    	.nicknames .oldnickname{
    		margin-bottom:15px;
    	}
    	.nicknames .form_nickname .newnick{
    		margin-bottom:25px;
    	}
    	.nicknames .form_nickname .newnick  input{
    		width:80%;
    		border: 1px solid  black;
    	}
    </style>
	<body>
		<div class="nicknames">
			<div class="oldnickname">
				<span>昵称：</span>
				<span class="nickname"></span>
			</div>
			<form class="form_nickname">
				<div class="newnick">
					<span class="new">新昵称：</span>
					<input type="text" class="newNickname" name="nickname"/>
				</div>
				<input type="button" value="确定修改" class="btn btn-danger btn-block" id="uploadNickname"/>  
			</form>
		</div>
		<script>
			var telephone=window.localStorage.getItem("telephone");
			$(function() {
				$.ajax({
					url: servicePath+"sechandcar/app/users/shcUser/selectMyImgsrc",
                    async : false,
                    type: "post",
                    dataType: "json",
                    data: {"telephone":telephone},
                    success: function (data) {
                    	$(".nickname").html(data.nickname);
                    },
                    error: function(data){
                    	window.alert("错误");
                    }  
				});
			})        
		</script>
		<script>
			var telephone=window.localStorage.getItem("telephone");
            $("#uploadNickname").on("click", function(){
              //alert($(".telephone").val());
              $.ajax({
                type:"post",
                url:servicePath+"sechandcar/app/users/shcUser/uoploadNickname",
                //async:false,
                data: {"nickname": $.trim($("input[name=nickname]").val()),
                       "telephone":telephone},
                //datatype:'json',
                success:function(data){		
                 // window.alert(data);
                  if(data == 'success'){
                    //alert(1);
                    alert("修改成功");
                    window.location.href="member.html";
                  } 
                },
                error:function(data){
                  //console.log(data);
                  window.alert("上传失败");
                }
              });	
            });
        </script>
	</body>
</html>